<?php
/**
 * Search.php
 * 
 * @category    Madoqua
 * @package     Module
 * @subpackage  BlogAdmin
 */

/** base class*/
require_once 'Madoqua/Form.php';

/** html entities filter */
require_once 'Zend/Filter/HtmlEntities.php';

/**
 * BlogAdmin_Post_Search
 *
 * @category    Madoqua
 * @package     Module
 * @subpackage  BlogAdmin
 */
class BlogAdmin_Post_Search extends Madoqua_Form
{
    /**
     * constructor
     * @param array $options
     */
    public function __construct($options = null) {
        $options['donttrack'] = true;
        //don't track the form name (this is a get form and it's just ugly)
        
        parent::__construct($options);

        $this->setMethod('get');
        //searching goes through get... you eedeeot!
        
        $this->setAttrib('class', 'search');
        $this->setAttrib('id', 'post_search');
        //this is a search form... go go awesome dikdik css powers!
        
        $this->setRouteAction(array(
            'action' => 'search',
            'controller' => 'post'
        ), 'blog_admin', true);
        //set the proper route
        
        $this->addElement('text', 'q', array(
            'required' => true,
            'filters' => array(
                new Zend_Filter_HtmlEntities(ENT_COMPAT, 'UTF-8')
            )
        ));
        //title
        
        $this->addElement('submit', 'submit', array(
            'label' => 'Search',
            'value' => null
        ));
        //submit
        
    }
}